<!--
 * @Author: ZhaoZhiqi
 * @Date: 2022-09-01 16:43:31
 * @LastEditors: ZhaoZhiqi
 * @LastEditTime: 2023-01-10 14:39:04
 * @Description: 政务驾驶舱（数据统计）
 * @FilePath: \tuanfeng-mini\src\pages\stat.vue
-->
<template>
    <div class="container">
        <div class="card">
            <div class="title">小程序访问量</div>
            <img class="left" src="https://tuanfeng.whkxzj.com/profile/static/20230109162358-1.png" alt />
            <div class="right">
                <div class="item">
                    <div class="label">昨日访问</div>
                    <div class="value">
                        <div class="count">
                            <span>{{info.dayPV}}</span>
                        </div>
                        <div class="unit">次</div>
                    </div>
                </div>
                <div class="item">
                    <div class="label bottom">累计访问</div>
                    <div class="value">
                        <div class="count bottom">
                            <span>{{info.allPV}}</span>
                        </div>
                        <div class="unit bottom">次</div>
                    </div>
                </div>
            </div>
        </div>
        <div class="card">
            <div class="title">12345热线</div>
            <img class="left" src="https://tuanfeng.whkxzj.com/profile/static/20230109162514-2.png" alt />
            <div class="right">
                <div class="item">
                    <div class="label">已办结</div>
                    <div class="value">
                        <div class="count">
                            <span>{{info.probReplyedCount}}</span>
                        </div>
                        <div class="unit">个</div>
                    </div>
                </div>
                <div class="item">
                    <div class="label bottom">未办结</div>
                    <div class="value">
                        <div class="count bottom">
                            <span>{{info.probUnreplyCount}}</span>
                        </div>
                        <div class="unit bottom">个</div>
                    </div>
                </div>
            </div>
        </div>
        <div class="card">
            <div class="title">帮代办</div>
            <img class="left" src="../static/img/stat_3.png" alt />
            <div class="right">
                <div class="item">
                    <div class="label">已提交</div>
                    <div class="value">
                        <div class="count">
                            <span>{{info.agentReplyCount}}</span>
                        </div>
                        <div class="unit">件</div>
                    </div>
                </div>
                <div class="item">
                    <div class="label bottom">已办结</div>
                    <div class="value">
                        <div class="count bottom">
                            <span>{{info.agentReplyedCount}}</span>
                        </div>
                        <div class="unit bottom">件</div>
                    </div>
                </div>
            </div>
        </div>
        <div class="card">
            <div class="title">好差评</div>
            <img class="left" src="https://tuanfeng.whkxzj.com/profile/static/20230109162657-3.png" alt />
            <div class="right">
                <div class="item" style="margin: 10px 0">
                    <div class="label" style="color: #00eaff">评价总数</div>
                    <div class="value">
                        <div class="count">
                            <span style="color: #00eaff">{{info.estimateCount}}</span>
                        </div>
                        <div class="unit">个</div>
                    </div>
                </div>
                <div class="item" style="margin: 10px 0">
                    <div class="label bottom">满意率</div>
                    <div class="value">
                        <div class="count bottom">
                            <span>{{info.estimateCount ? (info.goodEstimateCount/info.estimateCount*100).toFixed(0) : 0}}</span>
                        </div>
                        <div class="unit bottom">%</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
<script>
import { getStatAPI } from "../api/stat";

export default {
    data() {
        return {
            info: {
                allPV: "-",
                dayPV: "-",
                probReplyedCount: "-",
                probUnreplyCount: "-",
                agentReplyCount: "-",
                agentReplyedCount: "-",
                estimateCount: "-",
                goodEstimateCount: "-",
                badEstimateCount: "-",
            },
        };
    },
    onShareAppMessage() {},
    onShow() {
        getStatAPI().then((res) => {
            console.log(res);
            this.info = res.data;
        });
    },
    mounted() {},
    methods: {},
};
</script>
<style scoped lang="scss">
@import "../assets/scss/common.scss";

.container {
    min-height: 100vh;
    background-color: #023884;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    box-sizing: border-box;
    padding: 15px 0;
    .card {
        position: relative;
        width: 92vw;
        height: 49vw;
        margin-bottom: 15px;
        display: flex;
        justify-content: center;
        align-items: center;
        padding-top: 20px;
        box-sizing: border-box;
        background-color: #042e68;
        &:last-child {
            margin: 0;
        }
        .title {
            position: absolute;
            top: 15px;
            left: 20px;
            font-size: 17px;
            font-weight: bold;
            color: #00ffff;
        }
        .left {
            width: 80px;
            height: 60px;
            margin-right: 15px;
        }
        .right {
            .item {
                display: flex;
                align-items: center;
                margin: 15px 0;
                .label {
                    width: 75px;
                    height: 21px;
                    background-image: url("https://tuanfeng.whkxzj.com/profile/static/20230109162817-4.png");
                    background-repeat: no-repeat;
                    background-size: contain;
                    background-position: center;
                    font-size: 14px;
                    line-height: 21px;
                    text-align: center;
                    color: #fff;
                    margin-right: 15px;
                    &.middle {
                        background-image: url("https://tuanfeng.whkxzj.com/profile/static/20230109162857-5.png");
                    }
                    &.bottom {
                        color: #ffde00;
                        background-image: url("https://tuanfeng.whkxzj.com/profile/static/20230109162927-6.png");
                    }
                }
                .value {
                    display: flex;
                    align-items: flex-end;
                    .count {
                        width: 112.5px;
                        height: 30px;
                        background-image: url("https://tuanfeng.whkxzj.com/profile/static/20230109163007-7.png");
                        background-repeat: no-repeat;
                        background-size: contain;
                        background-position: center;
                        margin-right: 3px;
                        display: flex;
                        justify-content: flex-end;
                        align-items: center;
                        color: #fff;
                        font-size: 18px;
                        font-weight: bold;
                        padding-right: 5px;
                        box-sizing: border-box;
                        &.bottom {
                            color: #ffde00;
                            background-image: url("https://tuanfeng.whkxzj.com/profile/static/20230109163036-8.png");
                        }
                    }
                    .unit {
                        font-size: 12px;
                        color: #00eaff;
                        &.bottom {
                            color: #ffde00;
                        }
                    }
                }
            }
        }
    }
}
</style>